<?php

	$type = request('type',false,true);
	require_once $_site->get_handlepath('info');
	$title=$type==1?"在线留言":"联系我们";
	$hover[$type]='class="hover"';	

	if($type==1){
		$page = request('page',false,true,false,1);
		require_once $_site->get_handlepath('guest_book');
		$list = guest_book_fun_list(array('cat'=>1,'isreply'=>1,'hidden_flag'=>0),$page,5);
		if($list['rows']){
			$urlparam = '/wap/contact&type=1';
			$pagination = "<span><font style='color:red'>$page</font>/{$list['page_count']}</span>".page_method($list['row_count'],$page,$list['page_count'],0,$urlparam,false);
		}
	}

	if($type==2){
		require_once $_site->get_handlepath('info');
		$list = info_fun_info_list(array('cid'=>153,'hidden_flag'=>0),1,1);
		if($list){
			$rows=$list['rows'][0];
			$info=info_fun_get_info_by_id($rows['id']);
		}		
	}
	
	require_once $_site->get_viewpath("wap/commom/head");
?>

<script type="text/javascript" charset="utf-8" src="/plugin/cooperation_unit/artdialog/jquery.artDialog.source.js?skin=default"></script>
<script type="text/javascript" language="javascript">
loader.file({
		plugin:['validform/main','dialog/main'],
			js:['city_area', 'html','sms_send']
	});
	$(function (){

var form_obj=$("#form1").Validform({
	   tiptype: function(msg, o, cssctl){
		   if(!o.obj.is("form")){
			   /*var obj = o.obj.parent("td").find('tt');
			   cssctl(obj, o.type);
			   obj.text(msg);*/
		   }
	   },
	   ajaxPost:true,
	   callback:function (data){
			var k =art.dialog({
				id:'id1',
				title:false,
				content:"<div>"+data.msg+"</div>",
				cancel:false,
				fixed:true,
				lock:true,
				close:function (){
					if(data.state){
						location.href="/wap/contact&type=1";
					}
				}
			}).time(3);
	   }
	});
	})
</script>
<body>
	<div class="tittle">
      <a href="javascript:window.history.go(-1);" class="arrow_carrot-left return"></a>
	  <?php echo $title?>
	  <a href="/wap/index" class="icon_house house" style="vertical-align:middle;"></a>
    </div>

	<div class="nav">
		<a <?php echo $hover[1];?> href="/wap/contact&type=1">在线留言</a>
		<a <?php echo $hover[2];?> href="/wap/contact&type=2">联系我们</a>
	</div>
<div class="newspage">	
    <div class="news_bottom" style="margin-top:10px;">
		<?php
			if($type==1){
				?>
				<form action="/handle.php" method="post" id='form1'>
				<input type="hidden" name="h" value="guest_book/add_dis">
				<ul>
					<li><span class="col_1">称&nbsp;&nbsp;&nbsp;&nbsp;呼：</span><div class="col_2 ly_pt"><input name="name" type="text" id="name" class="cinput" datatype="*" nullmsg="请输入姓名"/></div></li>
					<li><span class="col_1">电&nbsp;&nbsp;&nbsp;&nbsp;话：</span><div class="col_2 ly_pt"><input name="phone" type="text" id="phone" class="cinput" datatype="m" nullmsg="请输入11位手机号" errormsg="请输入11位手机号"/></div></li>
					<!--<li><span class="col_1">标题：</span><div class="col_2 ly_pt"><input name="title" type="text" id="title" size="64" class="cinput" datatype="*" nullmsg="主题不能为空"/></div></li>-->
					<li><span class="col_1">内&nbsp;&nbsp;&nbsp;&nbsp;容：</span><div class="col_2 ly_txt"><textarea cols="" rows="5" name="content" datatype="*" nullmsg="留言内容不能为空"></textarea></div></li>
					<li><span class="col_1">验证码：</span><div class="col_2 ly_txt"><input class="yzm" type="text" name="auth_code" value="">
<span class="auth_code"><img style="cursor: pointer; vertical-align:text-bottom;" id="codeimg" src="/handle.php?h=auth_code/entry&height=25&width=100&size=14" onClick="this.src=this.src+'&k='+Math.random()" alt="验证码" /></span></div></li>
					<li><span class="col_1">&nbsp;</span><div class="col_2 ly_bt"><input name="" class="input_bt" type="submit" value="提 交"></div></li>
				</ul>
				</form>
				
				
			<?php
			if($list['rows']){
				foreach($list['rows'] as $row){
					?>
					<div class="mesgge">
						<ul>							
							<li><span class="col_1">留言人：</span><div class="col_2"><?php echo $row['user_name'];  ?></div></li>
							<li><span class="col_1">留&nbsp;&nbsp;&nbsp;&nbsp;言：</span><div class="col_2"><?php echo strip_tags( htmlspecialchars_decode($row['content'])); ?></div></li>
							<li style=" border-bottom:1px solid #ccc;"><span class="col_1">回&nbsp;&nbsp;&nbsp;&nbsp;复：</span><div class="col_2" style=" color:#FF0000;"><?php echo strip_tags( htmlspecialchars_decode($row['replycontent'])); ?></div></li>
						</ul>
					</div>
					<?php
				}
				?>
				<div class="page">
	              <?php echo $pagination ?>
               </div>
				<?php
			}				
			}else{
if($info){
	//$str=preg_replace(array('/(?:height|width)=(\'|").*?\\1/','/<p[^>]+>/'), array("style='width:100%'",'<p>'),$info['content']);
	$str = $info['content'];
	echo htmlspecialchars_decode($str);
}
			}
		?>

	

			</div>
	
	<?php require_once $_site->get_viewpath("wap/commom/bottom");?>
</body>
</html>
